package com.cq.hd.order.mapper;

import com.cq.hd.order.api.dto.OrderSettleBillDto;
import com.cq.hd.order.api.dto.OrderSettleBillUpdateStateDto;
import com.cq.hd.order.api.vo.OrderSettleBillVo;
import com.cq.hd.order.po.TbOrderSettleBillPo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 订单结算支付流水记录表 Mapper 接口
 * </p>
 *
 * @author mYunYu
 * @since 2024-01-23
 */
@Mapper
public interface TbOrderSettleBillMapper extends BaseMapper<TbOrderSettleBillPo> {

    List<OrderSettleBillVo> listByDto(OrderSettleBillDto orderSettleBillDto);

    int updateOrderSettleBill(OrderSettleBillVo orderSettleBillVo);

    int updateInvoiceStatusById(@Param("id") Long id, @Param("invoiceStatus") Integer invoiceStatus);

    int updateOrderBillsByMonthSettle(@Param("monthSettleBillId") Long monthSettleBillId, @Param("orderBillIds") List<Long> orderBillIds);

    BigDecimal sumMerchantPendingAmt(@Param("merchantId") Long merchantId, @Param("tradeType") Integer tradeType);

    // 根据月度结算单ID，获取订单id
    List<Long> getOrderIdsByMonthSettleIds(@Param("monthSettleIds") List<Long> monthSettleIds);

    BigDecimal sumBusinessWaitPaySubsidyAmt(@Param("businessId") Long businessId);

    int updateTradeState(OrderSettleBillUpdateStateDto orderSettleBillUpdateStateDto);
}

